//
//  DesignSideCountCell.m
//  ForestPack
//
//  Created by jimmy on 2018/7/24.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "DesignSideCountCell.h"
#import "Masonry.h"

@interface DesignSideCountCell()

@end

@implementation DesignSideCountCell

+(DesignSideCountCell *)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"DesignSideCountCell";
    DesignSideCountCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[DesignSideCountCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell creatViewUI];
    }
    return cell;
}

-(void)creatViewUI
{
    UILabel *needCount = [[UILabel alloc] init];
    needCount.text = @"需要数量：100";
    needCount.textColor = FONTCOLOR_BLACK;
    needCount.textAlignment = NSTextAlignmentLeft;
    needCount.font = Kfont(14);
    [self addSubview:needCount];
    [needCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(13);
        make.top.equalTo(self.mas_top).offset(10);
        make.width.equalTo(@(ScreenX375(150)));
        make.height.equalTo(@24);
    }];
    
    UILabel *countLabel = [[UILabel alloc] init];
    countLabel.text = @"666.66";
    countLabel.textColor = RGB_COLOR(237,34,59);
    countLabel.textAlignment = NSTextAlignmentRight;
    countLabel.font = Kfont(14);
    [self addSubview:countLabel];
    [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_right).offset(-53);
        make.top.equalTo(self.mas_bottom).offset(10);
        make.width.equalTo(@80);
        make.height.equalTo(@24);
    }];
    
    UILabel *unitLabel = [[UILabel alloc] init];
    unitLabel.text = @"元/件";
    unitLabel.textColor = FONTCOLOR_BLACK;
    unitLabel.textAlignment = NSTextAlignmentLeft;
    unitLabel.font = Kfont(14);
    [self addSubview:unitLabel];
    [unitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_right).offset(-13);
        make.top.equalTo(self.mas_bottom).offset(10);
        make.width.equalTo(@40);
        make.height.equalTo(@24);
    }];
    
}

@end


@interface BiddingPeopleCountCell()

@end

@implementation BiddingPeopleCountCell

+(BiddingPeopleCountCell *)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"BiddingPeopleCountCell";
    BiddingPeopleCountCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[BiddingPeopleCountCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell creatViewUI];
    }
    return cell;
}

-(void)creatViewUI
{
    UILabel *nameTitle = [[UILabel alloc] init];
    nameTitle.text = @"吾诺瀚卓设计师参加竞标";
    nameTitle.textColor = FONTCOLOR_BLACK;
    nameTitle.textAlignment = NSTextAlignmentLeft;
    nameTitle.font = Kfont(12);
    [self addSubview:nameTitle];
    [nameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(13);
        make.top.equalTo(self.mas_top).offset(10);
        make.width.equalTo(@(ScreenX375(200)));
        make.height.equalTo(@24);
    }];
    
    UILabel *stateLabel = [[UILabel alloc] init];
    stateLabel.text = @"雇主已选择";
    stateLabel.textColor = RGB_COLOR(237,34,59);
    stateLabel.textAlignment = NSTextAlignmentRight;
    stateLabel.font = Kfont(12);
    [self addSubview:stateLabel];
    [stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-13);
        make.top.equalTo(self.mas_top).offset(10);
        make.width.equalTo(@80);
        make.height.equalTo(@24);
    }];
    
    UIImageView *lineImageV = [[UIImageView alloc] init];
    lineImageV.image = [UIImage imageNamed:@"虚线"];
    [self addSubview:lineImageV];
    [lineImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_bottom).offset(-1);
        make.width.equalTo(@(SCREEN_WIDTH));
        make.height.equalTo(@1);
    }];
    
}

@end


@implementation RinkingCell

+(RinkingCell *)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"RinkingCell";
    RinkingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[RinkingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell creatViewUI];
    }
    return cell;
}

-(void)creatViewUI
{
    NSArray *rinkingArr = @[@"第一名：",@"第二名：",@"第三名：",@"第四名："];
    NSArray *moneyArr = @[@"500.00元",@"400.00元",@"300.00元",@"200.00元"];
    
    for (int i = 0; i < 4; i ++) {
        CGFloat xWid = 63*(i+1)+i*50;
        
        UILabel *rinking = [[UILabel alloc] init];
        rinking.text = rinkingArr[i];
        rinking.textColor = FONTCOLOR_BLACK;
        rinking.textAlignment = NSTextAlignmentLeft;
        rinking.font = Kfont(12);
        [self addSubview:rinking];
        if (xWid > (SCREEN_WIDTH/2)) {
            if (i > 1) {
                [rinking mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.mas_left).offset(13*(i-1)+((i-2)*ScreenX375(100)));
                    make.top.equalTo(self.mas_top).offset(30);
                    make.width.equalTo(@(ScreenX375(50)));
                    make.height.equalTo(@20);
                }];
            }else{
                [rinking mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.mas_left).offset(13*(i+1)+(i*ScreenX375(100)));
                    make.top.equalTo(self.mas_top).offset(30);
                    make.width.equalTo(@(ScreenX375(50)));
                    make.height.equalTo(@20);
                }];
            }
            
        }else{
            [rinking mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(13*(i+1)+(i*ScreenX375(100)));
                make.top.equalTo(self.mas_top).offset(10);
                make.width.equalTo(@(ScreenX375(50)));
                make.height.equalTo(@20);
            }];
        }
        
        UILabel *money = [[UILabel alloc] init];
        money.text = moneyArr[i];
        money.textColor = RGB_COLOR(237,34,59);
        money.textAlignment = NSTextAlignmentLeft;
        money.font = Kfont(12);
        [self addSubview:money];
        if (xWid > (SCREEN_WIDTH/2)) {
            if (i > 1) {
                [money mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.mas_left).offset(63*(i-1)+(i-2)*50);
                    make.top.equalTo(self.mas_top).offset(30);
                    make.width.equalTo(@60);
                    make.height.equalTo(@20);
                }];
            }
            [money mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(63*(i+1)+i*50);
                make.top.equalTo(self.mas_top).offset(30);
                make.width.equalTo(@60);
                make.height.equalTo(@20);
            }];
        }else{
            [money mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.mas_left).offset(63*(i+1)+i*50);
                make.top.equalTo(self.mas_top).offset(10);
                make.width.equalTo(@60);
                make.height.equalTo(@20);
            }];
        }
        
    }
    
}

@end
